// Written by Jonathan Dibble, Microsoft Corporation
// CODE IS PROVIDED AS-IS WITH NO WARRIENTIES EXPRESSED OR IMPLIED.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WMPRemote
{
	using System.Runtime.InteropServices;

	/// <summary>
	/// This application shows how to use COM Interop to call the appropriate interfaces
	/// on the Windows Media Player control.
	/// </summary>
	/// <remarks>
	/// Inside this project we use the <see cref="IOleObject"/> interface used by the Windows
	/// Media Player ActiveX control.  We also use the <see cref="IOleClientSite"/> and <see cref="IOleServiceProvider"/> to tell the
	/// WMP Control about ourself.  Finally, <see cref="RemoteHostInfo"/> implements <see cref="IWMPRemoteMediaServices"/> which tells
	/// Windows Media Player that we want to remote the control and provides an application name which appears in Windows
	/// Media Player (under the View menu option.)<br/>
	/// Although not implemented here, you can add a reference to the WMP.DLL to attach events to the running
	/// instance of Media Player.  I removed it from this project reduce size and complexity. <br/>
	/// Additionally, you can run AxImp WMP.DLL /source to generate a C# wrapper for the WMP ActiveX Control.  If you do,
	/// merge the generated AttachInterfaces method with the one from <see cref="RemotedWindowsMediaPlayer.AttachInterfaces"/>.  This will give you
	/// a much fuller control with all properties and events automatically generated for you.
	/// </remarks>
	public class FrmMain : System.Windows.Forms.Form
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.Panel panel1;

		RemotedWindowsMediaPlayer rm;

		/// <summary>
		/// Default Constructor
		/// </summary>
		public FrmMain()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();


			//Call me old fashioned - I like to do this stuff manually.  You can do a drag
			//drop if you like, it won't change the results.
			rm = new RemotedWindowsMediaPlayer();
			rm.Dock = System.Windows.Forms.DockStyle.Fill;
			panel1.Controls.Add(rm);


			return;
		}


		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.panel1 = new System.Windows.Forms.Panel();
			this.SuspendLayout();
			// 
			// panel1
			// 
			this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel1.Location = new System.Drawing.Point(0, 0);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(292, 267);
			this.panel1.TabIndex = 2;
			// 
			// FrmMain
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 267);
			this.Controls.Add(this.panel1);
			this.Name = "FrmMain";
			this.Text = "Remoted Player";
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new FrmMain());
		}

	}
}
